<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
    template="../WEB-INF/layout/template.xhtml"
    >
    
    <ui:define name="left_content">
      <s:fragment rendered="#{identity.loggedIn}">
        <rich:panel>
          <f:facet name="header">#{messages['jsf.Actions']}</f:facet>
          <s:link styleClass="action_link" view="/profile/edit.xhtml" propagation="none">
            #{messages['jsf.EditProfile']}
          </s:link>
          <s:link styleClass="action_link" view="/account/changepassword.xhtml" propagation="none" rendered="#{zanataInit.internalAuthentication}">
            #{messages['jsf.ChangePassword']}
          </s:link>
        </rich:panel>
      </s:fragment>
    </ui:define>
    
    <ui:define name="center_content">
        <rich:jQuery selector="#tab_profile" query="addClass('ui-tabs-selected')" />
        <h1>#{personHome.instance.account.username}</h1>
        <h2>#{messages['jsf.MyProjects']}</h2>
        <h:outputText value="None Available" rendered="#{empty personHome.instance.maintainerProjects}"/>
        <rich:dataGrid value="#{personHome.instance.maintainerProjects.toArray()}" 
                       var="project" 
                       columns="3"
                       columnClasses="grid_col"
                       styleClass="grid_style">
          <ui:include src="../WEB-INF/layout/project_view_inline.xhtml" />
        </rich:dataGrid>
        <h2>#{messages['jsf.MyLanguages']}</h2>
        <h:outputText value="None Available" rendered="#{empty personHome.instance.languageMemberships}"/>
        <rich:dataGrid value="#{personHome.instance.languageMemberships.toArray()}" 
                       var="tribe" 
                       columns="3"
                       columnClasses="grid_col"
                       styleClass="grid_style">
          <ui:include src="../WEB-INF/layout/language_view_inline.xhtml" />
        </rich:dataGrid>
        <h2>#{messages['jsf.ApiKey']}</h2>
        <h:form>
          <s:token allowMultiplePosts="true" />
          <s:span id="no_api_key" rendered="#{personHome.instance.account.apiKey == null}">#{messages['jsf.NotGenerated']}</s:span>
          <s:fragment id="api_key" rendered="#{personHome.instance.account.apiKey != null}"> 
            <p>#{messages['jsf.YourCurrentApiKeyIs']}
              <code>#{personHome.instance.account.apiKey}</code> 
            </p>
          </s:fragment>
          <h:commandButton action="#{personHome.regenerateApiKey}"
              value="Regenerate API Key" reRender="api_key,no_api_key"
              onclick="if (!confirm('Are you sure you want to regenerate your API Key?')) return false" />
	    </h:form>
    </ui:define>
</ui:composition>
